{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Example lactam analysis using a single cores on a very large dataset."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/kellebr5/anaconda/lib/python2.7/site-packages/ipykernel/__main__.py:4: RuntimeWarning: to-Python converter for std::vector<boost::shared_ptr<RDKit::ROMol>, std::allocator<boost::shared_ptr<RDKit::ROMol> > > already registered; second conversion method ignored.\n"
     ]
    }
   ],
   "source": [
    "from rdkit import Chem\n",
    "from rdkit.Chem.Draw import IPythonConsole\n",
    "IPythonConsole.ipython_useSVG=True\n",
    "from rdkit.Chem.rdRGroupDecomposition import RGroupDecomposition\n",
    "import pandas as pd\n",
    "from rdkit.Chem import PandasTools"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAcIAAACWCAIAAADCEh9HAAAFvklEQVR4nO3d4XKbOBSAUdjpG7Xv\nl+QB80z0BzvUwRgDVwgJnTM7O6030zpd+vkKYdwPw9ABcNR/Vz8BgLrJKECIjAKEyChAiIwChMgo\nQIiMAoTIKECIjAKEyChAiIwChMgoQIiMAoTIKECIjAKEyChAyK+rnwCcqO/75wfdqpy0ZJT6fH8v\nxPHPn4WvXCxm3/dKSkIyShGmMv7+PTw/OPP4NRNh5Cpelrne93c/lfHxx+cxkJKQLSbKkqGhXdcN\nw7B42hQO8JpMERYX9acykJKKI4my5FnUj5SUJCzqud6rrSSogozSLmdIScKihiLkPzc6sbQnyAFE\n62SUIIt6rlTCWVFLe4JkFJSUEBnlMjmvbYLzyCh0nYGUABnlGgWOokrKMTIKECKjXKDAUXRkIOUA\nGYUflJS9ZJTcih1F4RgZhTkDKbvIKFkZRbkf7yYmq4rewF7RU+VaplHyqStMlvZsJKMAITJKJnWN\noqM8A+nn5+f0b2pU35FNpWrM6CjJM39VyamhMlqvX1c/AZpQb0NXLA6qHx8fi1+8UsnPB4meGlnd\n8OCmQBVldPGpLhazlu+Is5lGOV1FDV1xg2+Bk9hign9ejaIaygoZ5VwaxO3JKPzPKMoxMspZ+r4f\nG+S9QNybLSZOUd0QZxTlMNMoiU1D6PSIgZR7M42SUqXjm1GUCNMoaTwPoY8MpNyYjJLAGND12a3Y\nkhpFCbKoJ2Qso+LQMtMox20ZQh8VOJAaRYkzjXKEIRQmXnXZLTis9X1XyEFnFCUJi3r2iVdmGLrC\nVvYQIqN1KOFzJtYvadqlhJKaOknFkVSN2d3Rpx/naWvy6Fy+tLeiJxUHTR1WPmdi9kjyqp63m3Rh\nSV/lUkY5wEFzN4sT62FnZ+WqkhpFSchxc2dTRr++vrqdE2W2S5ryl9QoSlqOm4bMLn1f+V+fMyiF\nZFRDOczl9w2ZZeKxqtN/yn9d/bhrn+03lEuSk9F2PdZkSuoliclc0mfaSoSM0nU/p9GrSpqBXHIG\nl9/TEDtLnEFG+aHAmzBB4WSUuaZKahQlTkZZ0FRJIUhGaZdRlCTs1LNsHEjLr8zS0GyOJqsK/p5w\nocwlHZs4/Yazi0kXTzMEn10VLxUUzjRKNeSOMjk3ypr8e02Z7+hsM404GeWN24fm9t8gZ5NRilPC\nR4zAdjLKe2fPa5dH00BKhIyyyUmh6fvlezvlH0iVlMNklK2Sh2YMqP13aueCJy4wuz508vhI/rzW\n8o4DSuOgYZ9gaF4FtBxKyl4W9ewTWdpbxXNLMkoOr7aSCmSvib1klN32hqbv+7qGUCVlFxnliI2h\n6fveqUZuT0Y5yxjQShtqIGU7GeWg9dDcYAhVUjaSUY5bDI2FPK2RUUJmJa16If/MQMoWMkoadx1C\nlZS3ZJTjxr5M76G8X0NhCxklgSmgtxzcDKSsc2sSeC/ZXUte5dggXzMZ5aBbngk97HlcXf6j8Sd2\nRzIKm0wD6eICP9kryuMvrrmVkFGSuf18evoNSWe3b6nlbi7Ns8UEECKjHHH7wfMVu/Y8s6iHvBYr\n3ORr0m3IKOzwagxf3nda/CUU83ZkFPY5d6eeCskouy1OZC2cLT39exwGFzzVSEahJNJZITv17Nbm\nX/QWxm2OkVHSEBiaJaPwnlGUFTLKTovvUPS2RRomo/CGUZR1MgpvKCjrZBRWOV/BOzJKmNDQNhmF\n17xCsIGMsoeswBMZhRe8ZrCNjBKjNTRPRtmjnWJ6eWAzGSVGa2iejMIToyh7yChAiIzCE6Moe8go\nQIiMAoT4LCb28IFr8ERG2Wy2f207G7qus6gHCJJRgBAZpQ2PZ3VnP+37f//Afs6N0jYnfAkzjQKE\nmEbZbBjqvuDJmp1zyCh7VJfOR7PFOyRiUQ8QIqMAIRb1tK32E74UoB8cNwABFvUAITIKECKjACEy\nChAiowAhMgoQIqMAITIKECKjACEyChDyF85L9rY7jE+DAAAAAElFTkSuQmCC\n",
      "image/svg+xml": [
       "<?xml version='1.0' encoding='iso-8859-1'?>\n",
       "<svg version='1.1' baseProfile='full'\n",
       "              xmlns:svg='http://www.w3.org/2000/svg'\n",
       "                      xmlns:rdkit='http://www.rdkit.org/xml'\n",
       "                      xmlns:xlink='http://www.w3.org/1999/xlink'\n",
       "                  xml:space='preserve'\n",
       "width='450px' height='150px' >\n",
       "<rect style='opacity:1.0;fill:#FFFFFF;stroke:none' width='450' height='150' x='0' y='0'> </rect>\n",
       "<path d='M 183.169,132.683 186.304,116.607' style='fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 186.304,116.607 189.439,100.53' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 175.423,131.173 178.558,115.096' style='fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 178.558,115.096 181.693,99.0195' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 185.566,99.7747 163.52,67.0483' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 185.566,99.7747 199.079,90.6718' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 199.079,90.6718 212.592,81.5688' style='fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 163.52,67.0483 145.691,63.5716' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 145.691,63.5716 127.861,60.0948' style='fill:none;fill-rule:evenodd;stroke:#7F7F7F;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 163.52,67.0483 196.246,45.0026' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 196.246,45.0026 205.054,58.0775' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 205.054,58.0775 213.862,71.1524' style='fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 196.246,45.0026 203.3,30.5631' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 203.3,30.5631 210.353,16.1237' style='fill:none;fill-rule:evenodd;stroke:#CCCC00;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 223.992,77.3338 240.825,76.1669' style='fill:none;fill-rule:evenodd;stroke:#0000FF;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 240.825,76.1669 257.657,75' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 257.657,75 279.703,107.726' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 257.657,75 274.976,39.5446' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 253.164,66.2179 265.287,41.3991' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 279.703,107.726 272.649,122.166' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 272.649,122.166 265.596,136.605' style='fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 279.976,111.663 296.587,110.511' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 296.587,110.511 313.198,109.36' style='fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 279.43,103.79 296.041,102.638' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 296.041,102.638 312.652,101.487' style='fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 274.976,39.5446 293.123,38.2866' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 293.123,38.2866 311.27,37.0285' style='fill:none;fill-rule:evenodd;stroke:#7F7F7F;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 274.976,39.5446 252.93,6.81818' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 252.93,6.81818 235.881,8.00014' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<path d='M 235.881,8.00014 218.831,9.18209' style='fill:none;fill-rule:evenodd;stroke:#CCCC00;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />\n",
       "<text x='171.871' y='145.081' style='font-size:13px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;text-anchor:start;fill:#FF0000' ><tspan>O</tspan></text>\n",
       "<text x='121.719' y='66.0725' style='font-size:13px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;text-anchor:start;fill:#7F7F7F' ><tspan>*</tspan></text>\n",
       "<text x='212.592' y='84.3055' style='font-size:13px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;text-anchor:start;fill:#0000FF' ><tspan>N</tspan></text>\n",
       "<text x='250.541' y='149.758' style='font-size:13px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;text-anchor:start;fill:#FF0000' ><tspan>OH</tspan></text>\n",
       "<text x='312.925' y='111.574' style='font-size:13px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;text-anchor:start;fill:#FF0000' ><tspan>O</tspan></text>\n",
       "<text x='311.27' y='43.3922' style='font-size:13px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;text-anchor:start;fill:#7F7F7F' ><tspan>*</tspan></text>\n",
       "<text x='208.299' y='16.1237' style='font-size:13px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;text-anchor:start;fill:#CCCC00' ><tspan>S</tspan></text>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<rdkit.Chem.rdchem.Mol at 0x109f501a0>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "core = Chem.MolFromSmiles('O=C1C([*])C2N1C(C(O)=O)=C([*])CS2')\n",
    "core"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To use RGroupDecomposition:\n",
    "  \n",
    "  1. construct the class on the core rg = RGroupDecomposition(core)\n",
    "  2. Call rg.Add( mol ) on the molecules.  If this returns -1, the molecule is not\n",
    "     compatible with the core\n",
    "  3. After all molecules are added, call rg.Process() to complete the rgroup\n",
    "     decomposition."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Added 1194 to RGroup Decomposition out of 4340\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "RDKit ERROR: [07:06:09] SMILES Parse Error: syntax error for input: 'CANONICAL_SMILES'\n"
     ]
    }
   ],
   "source": [
    "rg = RGroupDecomposition(core)\n",
    "\n",
    "mols = []\n",
    "count = 0\n",
    "for line in open(\"compounds.txt\"):\n",
    "    sm = line.split()[-1]\n",
    "    m = Chem.MolFromSmiles(sm)\n",
    "    if m:\n",
    "        count += 1\n",
    "        idx = rg.Add(m)\n",
    "rg.Process()\n",
    "print (\"Added %s to RGroup Decomposition out of %s\"%(idx, count))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "It is useful to disable logging here.  When making RGroup renderings there \n",
    "are a lot of sanitization warnings."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from rdkit import RDLogger\n",
    "RDLogger.DisableLog(\"rdApp.*\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The RGroupDecomposition code is quite compatiable with the python pandas integration.\n",
    "Calling rg.GetRGroupsAsColumns() can be sent directly into a pandas table.\n",
    "\n",
    "**n.b.** You need to call PandasTools.ChangeMoleculeRendering(frame) to allow the molecules\n",
    "to be rendered properly."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "frame = pd.DataFrame(rg.GetRGroupsAsColumns())\n",
    "PandasTools.ChangeMoleculeRendering(frame)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "Just show the fir"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Core</th>\n",
       "      <th>R1</th>\n",
       "      <th>R2</th>\n",
       "      <th>R3</th>\n",
       "      <th>R4</th>\n",
       "      <th>R5</th>\n",
       "      <th>R6</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td>None</td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td>None</td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td>None</td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td>None</td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td>None</td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "      <td><img src=\"\" alt=\"Mol\"/></td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>"
      ],
      "text/plain": [
       "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Core    R1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     R2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         R3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 R4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 R5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     R6\n",
       "0  <img src=\"\" alt=\"Mol\"/>  None  <img src=\"\" alt=\"Mol\"/>                                                                                                                                                                                                                              <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>                      <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>\n",
       "1  <img src=\"\" alt=\"Mol\"/>  None  <img src=\"\" alt=\"Mol\"/>                                                                                                                                                                                              <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>                      <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>\n",
       "2  <img src=\"\" alt=\"Mol\"/>  None  <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>                      <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>\n",
       "3  <img src=\"\" alt=\"Mol\"/>  None  <img src=\"\" alt=\"Mol\"/>                                                                                                                                                                                                              <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>\n",
       "4  <img src=\"\" alt=\"Mol\"/>  None  <img src=\"\" alt=\"Mol\"/>                                                                                              <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>                      <img src=\"\" alt=\"Mol\"/>  <img src=\"\" alt=\"Mol\"/>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f2 = pd.DataFrame(frame.head())\n",
    "PandasTools.ChangeMoleculeRendering(f2)\n",
    "f2"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
